package pl.edu.agh.hollonCommision.graph.connectionModel;

import dtp.commission.Commission;

public class PickupLocationProximityConnection implements IConnectionModel {

	private double distance;
	
	public PickupLocationProximityConnection(double distance) {
		this.distance = distance;
	}
	
	@Override
	public boolean areConnected(Commission commission, Commission commission2) {
		double x = commission.getPickupX() - commission2.getPickupX();
		double y = commission.getPickupY() - commission2.getPickupY();
		return (Math.sqrt(x * x + y * y) < distance );
	}

}
